//
//  ProfileImageView.m
//  CKApp
//
//  Created by CC on 2020/9/10.
//  Copyright © 2020 This Moment. All rights reserved.
//

#import "ProfileImageView.h"

@implementation ProfileImageView

- (void)layoutSubviews {
  [super layoutSubviews];
  self.layer.mask = nil;
  CGFloat radius = MIN(self.bounds.size.width, self.bounds.size.height) / 2.0;

  UIBezierPath* maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:(UIRectCornerAllCorners) cornerRadii:CGSizeMake(radius, radius)];
  CAShapeLayer* maskLayer = [[CAShapeLayer alloc] init];
  maskLayer.frame = self.bounds;
  maskLayer.path = maskPath.CGPath;
  self.layer.mask = maskLayer;
}

@end
